Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Extract identical code #305

Merged

Conversation

nickknissen
Copy link
Contributor

Enhancement

Since i use this library for a mobile client i need to keep the build size to a minimum.
So i extracted identical code into a function, to reduce the build size.

File Before After
vue-chartjs.js 15.9 KB 9.65 KB
vue-chartjs.min.js 7.49 KB 3.36 KB
  • All tests passed

Environment

  • OS: Windows 10
  • NPM Version: 5.5.1

Instead of including package.json file into the build files.
Use webpacks DefinePlugin to define a global lib version.
@apertureless
Copy link
Owner

Cool thanks for this! 🙏

Btw. as you're trying to save up space, you may want to add an alias for Chart.js so you pick the version without moment.js bundled into it. If you don't need time axis.

resolve: {
    alias: {
      'chart.js': 'chart.js/dist/Chart.js'
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants